import PropTypes from 'prop-types'
import React, { memo } from 'react'
import SectionRoomWrapper from './style'
import RoomItem from '@/components/room-item'

const SectionRoom = memo((props) => {
  const {roomItem,homeWidth='25%'} = props
  return (
    <SectionRoomWrapper>
          {
            roomItem?.slice(0,8).map((item) => {
              // RoomItem作为一个li包裹数据传递到RoomItem
              return (<RoomItem itemData={item} itemrWidth={homeWidth} key={item.id}/>)
            })
          }
    </SectionRoomWrapper>
  )
})

SectionRoom.propTypes = {
  roomItem: PropTypes.array,
  homeWidth: PropTypes.string,
}

export default SectionRoom